package com.sq.partner.manager.dao;

import java.sql.SQLException;
import java.util.List;
import java.util.Map;

import com.sq.partner.manager.mybatis.model.FacadeAppForm;

public interface FacadeAppFormDao extends BaseDao {

    /**
     * 得到一个新的投保单号
     * 
     * @return
     * @throws SQLException
     */
    public String queryNewAppNo() throws SQLException;

    /**
     * 添加投保单
     * 
     * @return
     * @throws SQLException
     */
    public void insertFacadeAppForm(FacadeAppForm facadeAppForm)
            throws Exception;

    /**
     * 修改投保单
     * 
     * @return
     * @throws SQLException
     */
    public void updateFacadeAppFormNotNull(FacadeAppForm uFacadeAppForm)
            throws Exception;

    /**
     * 根据暂存单号和投保状态取得投保单信息
     * 
     * @param facadeAppForm
     * @return
     * @throws Exception
     */
    public List<FacadeAppForm> selectFacadeAppFormList(
            FacadeAppForm facadeAppForm) throws Exception;

    /**
     * 根据暂存单号查询个人投保信息
     * 
     * @param stagNo
     * @return
     * @throws Exception
     */
    public FacadeAppForm queryNLifeSingleFacadeAppFormByStagNo(String stagNo)
            throws Exception;

    /**
     * 查询投保单信息
     * 
     * @param appNo
     * @return
     * @throws Exception
     */
    public FacadeAppForm queryFacadeAppFormByAppNo(String appNo)
            throws Exception;

    public List<FacadeAppForm> selectFacadeAppFormListPayByNlife(
            FacadeAppForm facadeAppForm) throws Exception;
    
    /**
     * 查询暂存单下的投保单数
     * @param stagNo
     * @return
     * @throws Exception
     */
    public int queryAppCountByStagNo(String stagNo) throws Exception;
    
    /**
     * 根据投保单号删除投保单
     * @param appNo
     * @return
     * @throws SQLException
     */
    public boolean deleteAppFormByAppNo(String appNo) throws Exception;
    
    /**
     * 支付完成后更新投保单表状态为12 已支付 20190425 helina
     * @param facadeAppForm
     * @return
     * @throws Exception
     */
    public boolean updateFacadeAppFormStatus12(FacadeAppForm facadeAppForm) throws Exception;
	
	/**
	 * 方案，投保起止期，证件类型，姓名，身份证号码查询已支付投保单号
	 * @param  map
	 * @return
	 * @throws Exception
	 */
	Integer queryExistInsuredCount(Map<String, Object> map) throws Exception;

    Integer queryExistInsuredCountBatch(Map<String, Object> map) throws Exception;
}
